// 封装文章评论接口方法
import request from '@/utils/request.js'

/**
 *获取文章评论
 * @param {*} params
 * @returns
 */
export const getArticleComment = params => {
  return request({
    method: 'GET',
    url: '/v1_0/comments',
    params
  })
}

/**
 * 对评论或评论回复点赞
 * @param {*} id 点赞的评论id
 * @returns
 */
export const addCommentGood = id => {
  return request({
    method: 'POST',
    url: '/v1_0/comment/likings',
    data: {
      target: id
    }
  })
}

/**
 * 对评论或评论回复取消点赞
 * @param {*} id 评论id
 * @returns
 */
export const deleteCommentGood = id => {
  return request({
    method: 'DELETE',
    url: '/v1_0/comment/likings/' + id
  })
}

/**
 * 添加评论或评论回复
 * @param {*} data {target:'',content:'',art_id:''}
 * @returns
 */
export const setComment = data => {
  return request({
    method: 'POST',
    url: '/v1_0/comments',
    data
  })
}
